<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>{$Think.lang.NAV_TITLE}</title>
<link href="__PUBLIC__/themes/css/login.css" rel="stylesheet" type="text/css" />
<script src="__PUBLIC__/js/jquery-1.7.1.js" type="text/javascript"></script>
<script type="text/javascript">
$(function(){
	var _VERIFY_URL_ = "{:U('Common/verifyCode')}";
	$('.verifyCode').click(function(){
		$(this).attr('src', _VERIFY_URL_ + "?id=" + Math.random());
	});
	$('#loginForm').submit(function(){
		var username = $("#loginForm input[name='username']").val();
		var password = $("#loginForm input[name='password']").val();
		var verifyCode = $("#loginForm input[name='verifyCode']").val();
		
		if(username.length < 5 || username.length > 20){
			alert("{$Think.lang.INVALIDATE_USERNAME_LEN}");
			$("#loginForm input[name='username']").focus();
			return false;
		}
		if(password.length < 5 || password.length > 50){
			alert("{$Think.lang.INVALIDATE_PASSWORD_LEN}");
			$("#loginForm input[name='password']").focus();
			return false;
		}
		if(verifyCode.length != 4){
			alert("{$Think.lang.INVALIDATE_VERIFYCODE_LEN}");
			$("#loginForm input[name='verifyCode']").focus();
			return false;
		}
		
		$.get("{:U('RegAndLogin/login?act=exec')}",{username: username , password:password, verifyCode:verifyCode },
			function(data){
				alert(data.info);
				if(data.status == 1){
					window.location.href="{:U('Index/index')}"
				}else{
					$("#loginForm input[name='" + data.data + "']").focus();
					$(".verifyCode").attr('src', _VERIFY_URL_ + "?id=" + Math.random());
				}
			},"json"
		);
		
		return false;
	});
});
</script>
</head>

<body>
	<div id="login">
		<div id="login_header">
			<h1 class="login_logo">
				<a href="#"><img src="__PUBLIC__/themes/default/images/login_logo.png" /></a>
			</h1>
			<div class="login_headerContent">
				<div class="navList">

				</div>
				<h2 class="login_title"><img src="__PUBLIC__/themes/default/images/login_title.png" /></h2>
			</div>
		</div>
		<div id="login_content">
			<div class="loginForm">
				<form action="{:U('RegAndLogin/login?act=exec')}" id="loginForm">
					<p>
						<label>{$Think.lang.UI_USERNAME}：</label>
						<input type="text" name="username" size="20" class="login_input" />
					</p>
					<p>
						<label>{$Think.lang.UI_PASSWORD}：</label>
						<input type="password" name="password" size="20" class="login_input" />
					</p>
					<p>
						<label>{$Think.lang.UI_VERIFYCODE}：</label>
						<input class="code" type="text" name="verifyCode" size="5" />
						<span><img class="verifyCode"  src="{:U('Common/verifyCode')}"  title="点击刷新" /></span>
					</p>
					<div class="login_bar">
						<input class="sub" type="submit" value=" " />
					</div>
				</form>
			</div>
			<div class="login_banner"><img src="__PUBLIC__/themes/default/images/login_banner.jpg" /></div>
			<div class="login_main">

			</div>
		</div>
		<div id="login_footer">
			Copyright &copy; 2012 www.ithinkblog.com Inc. All Rights Reserved.
		</div>
	</div>
</body>
</html>